package com.example.shiwuyouproject.net.http

import com.example.shiwuyouproject.base.BaseBean
import com.example.shiwuyouproject.base.BaseListBean
import com.example.shiwuyouproject.net.bean.User
import com.example.shiwuyouproject.ui.bean.*
import com.example.shiwuyouproject.ui.fragment.home.bean.*
import com.example.shiwuyouproject.ui.fragment.my.activity.bean.*
import com.example.shiwuyouproject.ui.fragment.my.bean.GetCommentListsBean
import com.example.shiwuyouproject.ui.fragment.my.bean.GetUserCenterBean
import com.example.shiwuyouproject.ui.my.bean.MyIncomeBean
import com.example.shiwuyouproject.ui.my.bean.PersonalInformationBean
import retrofit2.http.*
import java.util.*

/**
 * Created by yechaoa on 2020/2/4.
 * Describe :
 */
interface Api {

    companion object {
        //        const val BASE_URL = "http://d.zqapps.com/uk17/api/"
        const val BASE_URL = "https://api.swyvip.com/"
        const val Web_URL =
            "http://www.icootoo.com/fastks/public/index/user/contract.html?token="//协议地址
        const val IMAGEHEAD = "http://res.swyvip.com/"//图片地址
    }

    //登录
    @POST("user/login")
    suspend fun userLogin(
        @Query("account") account: String,
        @Query("password") password: String,
        @Query("from") from: String
    ): BaseBean<BaseUserBean<User>>

    //微信登录接口
    @POST("user/wxlogin")
    suspend fun getUserWxLogin(
        @Query("wx_open_id") wx_open_id: String,
        @Query("wx_uniq_id") wx_uniq_id: String,
        @Query("from") from: String
    ): BaseBean<BaseUserBean<User>>

    /**
     * 微信绑定
     */
    @POST("user/wxbind")
    suspend fun getUserMobileLogin(
        @Query("mobile") mobile: String,
        @Query("captcha") captcha: String,
        @Query("wx_open_id") wx_open_id: String,
        @Query("wx_uniq_id") wx_uniq_id: String,
    ): BaseBean<BaseUserBean<User>>
    /**
     * 获取验证码
     * mobile手机号
     * event： register,resetpwd
     */
    @POST("sms/send")
    suspend fun smsSend(
        @Query("mobile") mobile: String,
        @Query("event") event: String
    ):
            BaseBean<SmsSendBean>

    /**
     * 获取
     * 个人信息
     */
    @GET("user/get")
    suspend fun userUpdate(): BaseBean<PersonalInformationBean>

    /**
     * 保存
     * 保存个人信息
     */
    @FormUrlEncoded
    @POST("user/update")
    suspend fun addUserUpdate(
        @Field("idfront") idfront: String,
        @Field("idback") idback: String
    ): BaseBean<String>

    /**
     * 获取个人认证信息
     */
    @GET("user/auth")
    suspend fun userAuth(): BaseBean<UserAuthBean>

    /**
     * 保存
     * 保存头像
     */
    @FormUrlEncoded
    @POST("user/update")
    suspend fun addUserUpdate(@Field("avatar") avatar: String): BaseBean<String>

    /**
     * 保存
     * 保存各种数据
     */
    @FormUrlEncoded
    @POST("user/update")
    suspend fun addUserUpdate(@FieldMap hashMap: Map<String, String>): BaseBean<String>

    @POST("user/update")
    suspend fun addUserUpdateSava(@Body hashMap: Map<String, String>): BaseBean<String>

    @POST("user/update")
    suspend fun addUserUpdateSava(@Body bean: RewardsAndHonorsCommitBean): BaseBean<String>

    /**
     * 获取科目
     */
    @GET("data/lists")
    suspend fun dataLists(): BaseBean<DataListsBean>

    /**
     * 获取授课时间
     */
    @GET("course/lists")
    suspend fun courseLists(): BaseBean<CourseListsBean>

    /**
     * 收益统计
     */
    @POST("commission/total")
    suspend fun getCommissionTotal(@Query("create_year") create_year:String,@Query("create_month") create_month:String): BaseBean<CommissionTotalBean>

    /**
     * 我的收益
     */
    @FormUrlEncoded
    @POST("commission/lists")
    suspend fun PostCommissionLists(@Field("page") page: String,
                                    @Field("create_year") create_year: String,
                                    @Field("create_month") create_month: String): BaseBean<MyIncomeBean>

    /**
     * 个人中心用户信心
     */
    @GET("user/basic")
    suspend fun getUserCenter(): BaseBean<GetUserCenterBean>

    /**
     * 忘记/修改密码
     */
    @FormUrlEncoded
    @POST("user/updateSetting")
    suspend fun getUserResetpwd(@Field("mobile") mobile: String,
                                @Field("newpassword") newpassword: String,
                                @Field("captcha") captcha: String): BaseBean<Objects>


    /**
     * 我的申请列表
     */
    @GET("apply/lists")
    suspend fun getApplyrLists(@Query("page") page:String): BaseBean<ApplyListsBean>

    /**C
     * 我的收藏
     */
    @GET("favorite/lists")
    suspend fun getCommissionLists(@Query("page") page:String): BaseBean<ApplyListsBean>
    /**
     * 获取首页推荐机构
     */
    @GET("home/recommend")
    suspend fun getHomeRecommend(@Query("city") city:String,@Query("page") page:String): BaseBean<HomeRecommendListBean>
    /**
     * 获取评论
     */
    @GET("comment/lists")
    suspend fun getCommentLists(): BaseBean<GetCommentListsBean>

    /**
     * 获取分享内容
     */
    @GET("user/share_data")
    suspend fun getUserShareData(): BaseBean<GetUserShareDataBean>


    /**
     * 首页-获取首页数据
     */
    @GET("home/dashboard")
    suspend fun getHomeDashboard(): BaseBean<GetHomeDashboardBean>

    /**
     * 首页-获取首页数据
     */
    @GET("message/lists")
    suspend fun getMessageLists(@Query("page") page:String): BaseBean<GetMessageListMue1Bean<GetMessageListMue2Bean>>

    /**
     * 获取课程详细信息
     */
    @GET("post/get")
    suspend fun getPostGet(@Query("post_id") post_id:String): BaseBean<GetPostGetBean>

    /**
     * 课程详细信息 收藏
     */
    @GET("favorite/star")
    suspend fun getFavoriteStar(@Query("post_id") post_id:String): BaseBean<GetFavoriteStarBean>

    /**
     *申请课程
     */
    @GET("apply/add")
    suspend fun getApplyAdd(@Query("org_id") org_id:String,@Query("post_id") post_id:String): BaseBean<Objects>

    /**
     * 招聘列表(推荐)
     */
    @GET("post/recommend")
    suspend fun getPostRecommend(@Query("city") city:String,@Query("page") page:String): BaseBean<DataChlideBean>
    /**
     * 招聘列表（最新)
     */
    @GET("post/latest")
    suspend fun getPostLatest(@Query("city") city:String,@Query("page") page:String): BaseBean<DataChlideBean>

    /**
     * 搜索历史记录
     */
    @GET("search/lists")
    suspend fun getSearchLists(): BaseBean<GetMessageListMue1Bean<MutableList<GetSearchListsBean>>>

    /**
     * 搜索课程
     */
    @GET("post/search")
    suspend fun getPostSearch(@Query("city") city:String,@Query("keywords") keywords:String): BaseBean<ApplyListsBean>
}